Ejemplo n.º 1
0
 def test_mismatch_sets_matchee(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("foo", mismatch.matchee)
Ejemplo n.º 2
0
 def test_mismatch_sets_expected(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("bar", mismatch.expected)
Ejemplo n.º 3
0
 def test_match(self):
     matcher = EndsWith("arf")
     self.assertIs(None, matcher.match("barf"))
Ejemplo n.º 4
0
 def test_mismatch_returns_does_not_end_with(self):
     matcher = EndsWith("bar")
     self.assertIsInstance(matcher.match("foo"), DoesNotEndWith)
Ejemplo n.º 5
0
 def test_mismatch_sets_expected(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("bar", mismatch.expected)
Ejemplo n.º 6
0
 def test_generate_omapi_key_returns_a_key(self):
     key = generate_omapi_key()
     # Could test for != None here, but the keys end in == for a 512
     # bit length key, so that's a better check that the script was
     # actually run and produced output.
     self.assertThat(key, EndsWith("=="))
Ejemplo n.º 7
0
 def test_mismatch_returns_does_not_end_with(self):
     matcher = EndsWith("bar")
     self.assertIsInstance(matcher.match("foo"), DoesNotEndWith)
Ejemplo n.º 8
0
 def test_mismatch_sets_matchee(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("foo", mismatch.matchee)
Ejemplo n.º 9
0
 def test_match(self):
     matcher = EndsWith("arf")
     self.assertIs(None, matcher.match("barf"))
Ejemplo n.º 10
0
 def test_str(self):
     matcher = EndsWith("bar")
     self.assertEqual("Ends with 'bar'.", str(matcher))
Ejemplo n.º 11
0
    def test_uses_suffix(self):
        suffix = factory.make_string(3)
        with tempdir(suffix=suffix) as directory:
            pass

        self.assertThat(os.path.basename(directory), EndsWith(suffix))
Ejemplo n.º 12
0
 def test_encode_multipart_data_closes_with_closing_boundary_line(self):
     data = {'foo': make_string().encode('ascii')}
     files = {'bar': BytesIO(make_string().encode('ascii'))}
     body, headers = encode_multipart_data(data, files)
     self.assertThat(body, EndsWith(b'--'))
Ejemplo n.º 13
0
 def test_custom_section_ends_with_newline(self):
     self.assertThat(write_custom_config_section("x", "y"), EndsWith('\n'))