This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
apt-transport-https \ | |
openjdk-8-jre-headless \ | |
curl \ | |
xz-utils \ | |
unzip \ | |
bzip2 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test$MODEL$Serializer(TestCase): | |
def test_expected_fields(self): | |
$MODEL_LOWER$ = $MODEL$Factory.create() | |
serializer = $MODEL$Serializer(instance=$MODEL_LOWER$) | |
$MODEL_LOWER$_data = serializer.data | |
$MODEL_LOWER$_data_keys = ['id'] #Fixme Poner el resto de los campos del modelo | |
self.assertEqual(set($MODEL_LOWER$_data.keys()), set($MODEL_LOWER$_data_keys)) | |
def test_creation(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test$MODEL$ListAPIView(JWTTestMixin, TestCase): | |
def test_get(self): | |
$MODEL$Factory.create_batch(10) | |
url = reverse('$URL_NAMESPACE$:list-$MODEL_LOWER$') | |
user = UserFactory.create() | |
response = self.get_with_token(url, user) | |
self.response_200(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = { | |
$STATE$: [], | |
} | |
const getters = { | |
$STATE$: state => { | |
return state.$STATE$; | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JWTTestMixin(object): | |
def get_access_token(self, user): | |
token_url = reverse('token_obtain_pair') | |
pay_load = {'username': user.username, 'password': 'password'} | |
token_response = self.post(token_url, data=pay_load) | |
access_token = token_response.data['access'] | |
return access_token | |
def get_with_token(self, url, access_token): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = [ | |
url(r'^$', $MODEL$ListAPIView.as_view(), name='list-$MODEL_LOWER$'), | |
url(r'^$MODEL_LOWER$/create/$', $MODEL$CreateAPIView.as_view(), name='create-$MODEL_LOWER$'), | |
url(r'^$MODEL_LOWER$/update/(?P<pk>\d+)/$', $MODEL$DetailAPIView.as_view(), name='update-$MODEL_LOWER$'), | |
url(r'^$MODEL_LOWER$/delete/(?P<pk>\d+)/$', $MODEL$DetailAPIView.as_view(), name='delete-$MODEL_LOWER$'), | |
url(r'^$MODEL_LOWER$/(?P<pk>\d+)/$', $MODEL$DetailAPIView.as_view(), name='detail-$MODEL_LOWER$'), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.generics import ListAPIView, RetrieveUpdateDestroyAPIView, CreateAPIView | |
from ..models import $MODEL_NAME$ | |
class $MODEL_NAME$ListAPIView(ListAPIView): | |
serializer_class = $MODEL_NAME$Serializer | |
def get_queryset(self): | |
return $MODEL_NAME$.objects.all() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class $MODEL$Form(forms.ModelForm): | |
class Meta: | |
model = $MODEL$ | |
fields = ('id',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = [ | |
url(r'^$', $MODEL$ListView.as_view(), name='list'), | |
url(r'^create/$', $MODEL$CreateView.as_view(), name='create'), | |
url(r'^update/(?P<pk>\d+)/$', $MODEL$UpdateView.as_view(), name='update'), | |
url(r'^delete/(?P<pk>\d+)/$', $MODEL$DeleteView.as_view(), name='delete'), | |
url(r'^(?P<pk>\d+)/$', $MODEL$DetailView.as_view(), name='detail'), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wb = Workbook() | |
sheet = wb.create_sheet() | |
row = 1 | |
col = 1 | |
for header in headers: | |
sheet.cell(row=row, column=col, value=header) | |
col += 1 | |
row += 1 | |
git_lines = self.report(git_format) | |
for line in git_lines: |
NewerOlder