예제 #1
0
 def test_mismatch_sets_matchee(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("foo", mismatch.matchee)
예제 #2
0
 def test_mismatch_sets_expected(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("bar", mismatch.expected)
예제 #3
0
 def test_match(self):
     matcher = EndsWith("arf")
     self.assertIs(None, matcher.match("barf"))
예제 #4
0
 def test_mismatch_returns_does_not_end_with(self):
     matcher = EndsWith("bar")
     self.assertIsInstance(matcher.match("foo"), DoesNotEndWith)
예제 #5
0
 def test_mismatch_sets_expected(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("bar", mismatch.expected)
예제 #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("=="))
예제 #7
0
 def test_mismatch_returns_does_not_end_with(self):
     matcher = EndsWith("bar")
     self.assertIsInstance(matcher.match("foo"), DoesNotEndWith)
예제 #8
0
 def test_mismatch_sets_matchee(self):
     matcher = EndsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("foo", mismatch.matchee)
예제 #9
0
 def test_match(self):
     matcher = EndsWith("arf")
     self.assertIs(None, matcher.match("barf"))
예제 #10
0
 def test_str(self):
     matcher = EndsWith("bar")
     self.assertEqual("Ends with 'bar'.", str(matcher))
예제 #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))
예제 #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'--'))
예제 #13
0
 def test_custom_section_ends_with_newline(self):
     self.assertThat(write_custom_config_section("x", "y"), EndsWith('\n'))