def test_answer_challenges(self):
     self.net.answer_challenge = mock.MagicMock()
     self.assertEqual(
         [self.net.answer_challenge(
             self.challr.body, challenges.DNSResponse())],
         self.net.answer_challenges(
             [self.challr.body], [challenges.DNSResponse()]))
    def test_answer_challenge(self):
        self.response.links['up'] = {'url': self.challr.authzr_uri}
        self.response.json.return_value = self.challr.body.to_json()

        chall_response = challenges.DNSResponse()

        self._mock_post_get()
        self.net.answer_challenge(self.challr.body, chall_response)

        # TODO: split here and separate test
        self.assertRaises(errors.UnexpectedUpdate, self.net.answer_challenge,
                          self.challr.body.update(uri='foo'), chall_response)
 def test_answer_challenge_missing_next(self):
     self._mock_post_get()
     self.assertRaises(errors.NetworkError, self.net.answer_challenge,
                       self.challr.body, challenges.DNSResponse())