~rvb/maas/transaction-1.7-bug-1409852

« back to all changes in this revision

Viewing changes to src/provisioningserver/import_images/tests/test_keyrings.py

merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
            } for i in range(5)]
62
62
 
63
63
        keyring_path = self.make_dir()
64
 
        self.patch(
65
 
            keyrings.tempfile,
66
 
            'mkdtemp').return_value = keyring_path
67
64
 
68
 
        keyrings.write_all_keyrings(sources)
 
65
        keyrings.write_all_keyrings(keyring_path, sources)
69
66
 
70
67
        expected_calls = (
71
68
            mock.call(
84
81
            } for i in range(5)]
85
82
 
86
83
        keyring_path = self.make_dir()
87
 
        self.patch(
88
 
            keyrings.tempfile,
89
 
            'mkdtemp').return_value = keyring_path
90
84
 
91
85
        expected_values = [
92
86
            os.path.join(
94
88
                keyrings.calculate_keyring_name(source['url']))
95
89
            for source in sources]
96
90
 
97
 
        returned_sources = keyrings.write_all_keyrings(sources)
 
91
        returned_sources = keyrings.write_all_keyrings(keyring_path, sources)
98
92
        actual_values = [
99
93
            source.get('keyring') for source in returned_sources]
100
94
        self.assertEqual(expected_values, actual_values)
109
103
            }
110
104
 
111
105
        keyring_path = self.make_dir()
112
 
        self.patch(
113
 
            keyrings.tempfile,
114
 
            'mkdtemp').return_value = keyring_path
115
106
 
116
 
        [returned_source] = keyrings.write_all_keyrings([source])
 
107
        [returned_source] = keyrings.write_all_keyrings(keyring_path, [source])
117
108
        expected_keyring = os.path.join(
118
109
            keyring_path, keyrings.calculate_keyring_name(source['url']))
119
110
        self.assertEqual(expected_keyring, returned_source.get('keyring'))