Example #1
0
    def test_create_duplicate_keypair(self):
        keypair_name = self.keypairs.first().name

        api.nova.keypair_list(IsA(http.HttpRequest)) \
            .AndReturn(self.keypairs.list())
        self.mox.ReplayAll()

        form = CreateKeypair(self.request, data={'name': keypair_name})
        self.assertFalse(form.is_valid())
        self.assertIn('The name is already in use.', form.errors['name'][0])
Example #2
0
    def test_create_duplicate_keypair(self):
        keypair_name = self.keypairs.first().name

        api.nova.keypair_list(IsA(http.HttpRequest)) \
            .AndReturn(self.keypairs.list())
        self.mox.ReplayAll()

        form = CreateKeypair(self.request, data={'name': keypair_name})
        self.assertFalse(form.is_valid())
        self.assertIn('The name is already in use.',
                      form.errors['name'][0])