mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Code cleanup.
This commit is contained in:
parent
ebdd36cfeb
commit
d86f8b812b
4 changed files with 3 additions and 10 deletions
|
@ -11,8 +11,7 @@
|
||||||
#
|
#
|
||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
#import sys
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
|
|
@ -113,6 +113,6 @@ def pygmentize(code_string, lexer_name=LEXER_DEFAULT):
|
||||||
try:
|
try:
|
||||||
lexer = lexer_name and get_lexer_by_name(lexer_name) \
|
lexer = lexer_name and get_lexer_by_name(lexer_name) \
|
||||||
or PythonLexer()
|
or PythonLexer()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
lexer = PythonLexer()
|
lexer = PythonLexer()
|
||||||
return highlight(code_string, lexer, NakedHtmlFormatter())
|
return highlight(code_string, lexer, NakedHtmlFormatter())
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os import urandom
|
|
||||||
from random import SystemRandom
|
from random import SystemRandom
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
|
@ -5,8 +5,6 @@ from django.test.client import Client
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from ..models import Snippet
|
from ..models import Snippet
|
||||||
from ..forms import EXPIRE_DEFAULT
|
|
||||||
from ..highlight import LEXER_DEFAULT
|
|
||||||
|
|
||||||
class SnippetAPITestCase(TestCase):
|
class SnippetAPITestCase(TestCase):
|
||||||
|
|
||||||
|
@ -121,8 +119,6 @@ class SnippetAPITestCase(TestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
response = self.client.post(self.api_url, data)
|
response = self.client.post(self.api_url, data)
|
||||||
content = response.content.decode('utf-8')
|
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(Snippet.objects.count(), 1)
|
self.assertEqual(Snippet.objects.count(), 1)
|
||||||
|
|
||||||
|
@ -135,6 +131,5 @@ class SnippetAPITestCase(TestCase):
|
||||||
'lexer': 'foobar'
|
'lexer': 'foobar'
|
||||||
}
|
}
|
||||||
response = self.client.post(self.api_url, data)
|
response = self.client.post(self.api_url, data)
|
||||||
content = response.content.decode('utf-8')
|
|
||||||
self.assertEqual(response.status_code, 400)
|
self.assertEqual(response.status_code, 400)
|
||||||
self.assertEqual(Snippet.objects.count(), 0)
|
self.assertEqual(Snippet.objects.count(), 0)
|
||||||
|
|
Loading…
Reference in a new issue