コード例 #1
0
ファイル: test_models.py プロジェクト: chartjes/normandy
 def test_setting_signature_doesnt_change_canonical_json(self):
     recipe = RecipeFactory(name='unchanged', signed=False)
     serialized = recipe.canonical_json()
     recipe.signature = SignatureFactory()
     recipe.save()
     assert recipe.signature is not None
     assert recipe.canonical_json() == serialized
コード例 #2
0
ファイル: test_models.py プロジェクト: chartjes/normandy
 def test_cant_change_signature_and_other_fields(self):
     recipe = RecipeFactory(name='unchanged', signed=False)
     recipe.signature = SignatureFactory()
     recipe.name = 'changed'
     with pytest.raises(ValidationError) as exc_info:
         recipe.save()
     assert exc_info.value.message == 'Signatures must change alone'
コード例 #3
0
 def test_setting_signature_doesnt_change_canonical_json(self):
     recipe = RecipeFactory(name="unchanged", signed=False)
     serialized = recipe.canonical_json()
     recipe.signature = SignatureFactory()
     recipe.save()
     assert recipe.signature is not None
     assert recipe.canonical_json() == serialized
コード例 #4
0
ファイル: test_models.py プロジェクト: micdurodola/normandy
 def test_update_signature(self, mock_logger, mocked_autograph):
     recipe = RecipeFactory(enabler=UserFactory(), approver=UserFactory())
     recipe.signature = None
     recipe.update_signature()
     mock_logger.info.assert_called_with(
         Whatever.contains(str(recipe.id)),
         extra={"code": INFO_REQUESTING_RECIPE_SIGNATURES, "recipe_ids": [recipe.id]},
     )
     mocked_autograph.return_value.sign_data.assert_called_with(
         [Whatever(lambda s: json.loads(s)["id"] == recipe.id)]
     )
     assert recipe.signature is not None
コード例 #5
0
ファイル: test_models.py プロジェクト: rehandalal/normandy
 def test_update_signature(self, mock_logger, mocked_autograph):
     recipe = RecipeFactory(enabler=UserFactory(), approver=UserFactory())
     recipe.signature = None
     recipe.update_signature()
     mock_logger.info.assert_called_with(
         Whatever.contains(str(recipe.id)),
         extra={"code": INFO_REQUESTING_RECIPE_SIGNATURES, "recipe_ids": [recipe.id]},
     )
     mocked_autograph.return_value.sign_data.assert_called_with(
         [Whatever(lambda s: json.loads(s)["id"] == recipe.id)]
     )
     assert recipe.signature is not None
コード例 #6
0
 def test_cant_change_signature_and_other_fields(self):
     recipe = RecipeFactory(name="unchanged", signed=False)
     recipe.signature = SignatureFactory()
     with pytest.raises(ValidationError) as exc_info:
         recipe.revise(name="changed")
     assert exc_info.value.message == "Signatures must change alone"
コード例 #7
0
ファイル: test_models.py プロジェクト: rehandalal/normandy
 def test_cant_change_signature_and_other_fields(self):
     recipe = RecipeFactory(name="unchanged", signed=False)
     recipe.signature = SignatureFactory()
     with pytest.raises(ValidationError) as exc_info:
         recipe.revise(name="changed")
     assert exc_info.value.message == "Signatures must change alone"